package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.mapper.AdminTheoryMapper;
import com.ruoyi.system.domain.AdminTheory;
import com.ruoyi.system.service.IAdminTheoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 乐理Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-17
 */
@Service
public class AdminTheoryServiceImpl implements IAdminTheoryService 
{
    @Autowired
    private AdminTheoryMapper adminTheoryMapper;

    /**
     * 查询乐理
     * 
     * @param theoryId 乐理ID
     * @return 乐理
     */
    @Override
    public AdminTheory selectAdminTheoryById(Long theoryId)
    {
        return adminTheoryMapper.selectAdminTheoryById(theoryId);
    }

    /**
     * 查询乐理列表
     * 
     * @param adminTheory 乐理
     * @return 乐理
     */
    @Override
    public List<AdminTheory> selectAdminTheoryList(AdminTheory adminTheory)
    {
        return adminTheoryMapper.selectAdminTheoryList(adminTheory);
    }

    /**
     * 新增乐理
     * 
     * @param adminTheory 乐理
     * @return 结果
     */
    @Override
    public int insertAdminTheory(AdminTheory adminTheory)
    {
        adminTheory.setCreateTime(DateUtils.getNowDate());
        return adminTheoryMapper.insertAdminTheory(adminTheory);
    }

    /**
     * 修改乐理
     * 
     * @param adminTheory 乐理
     * @return 结果
     */
    @Override
    public int updateAdminTheory(AdminTheory adminTheory)
    {
        adminTheory.setUpdateTime(DateUtils.getNowDate());
        return adminTheoryMapper.updateAdminTheory(adminTheory);
    }

    /**
     * 删除乐理对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminTheoryByIds(String ids)
    {
        return adminTheoryMapper.deleteAdminTheoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除乐理信息
     * 
     * @param theoryId 乐理ID
     * @return 结果
     */
    @Override
    public int deleteAdminTheoryById(Long theoryId)
    {
        return adminTheoryMapper.deleteAdminTheoryById(theoryId);
    }
    
    /**
     * 乐理状态修改
     * 
     * @param theory 教材信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminTheory adminTheory)
    {
        return adminTheoryMapper.updateAdminTheory(adminTheory);
    }
}
